package com.li.youhappygo.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.li.youhappygo.mapper.ShopInfoMapper;
import com.li.youhappygo.model.entity.system.ShopInfo;
import com.li.youhappygo.service.ShopInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ShopInfoServiceImpl implements ShopInfoService {

    @Autowired
    ShopInfoMapper shopInfoMapper;
    @Override
    public ShopInfo getShopInfo(Integer shopId) {
        QueryWrapper<ShopInfo> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("id",shopId);
        ShopInfo shopInfo = shopInfoMapper.selectOne(queryWrapper);
        return shopInfo;
    }

    @Override
    public void updateShopInfo(ShopInfo shopInfo) {
        QueryWrapper queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("id",shopInfo.getId());
        shopInfoMapper.update(shopInfo,queryWrapper);
    }

    @Override
    public void insertShopInfo(ShopInfo shopInfo) {
        shopInfoMapper.insert(shopInfo);
    }
}
